#! /bin/sh

WIDTH=320
HEIGHT=400
WIDTHOFF1=0
WIDTHOFF2=400
WIDTHOFF3=800
HEIGHTOFF1=50
HEIGHTOFF2=500

## use susynlv to make synthetic data
susynlv nt=201 dt=0.004 ft=0.0 nxo=1 \
	nxs=100 dxs=.025 fxs=0.0 er=0 ob=0 \
	v00=2.0 dvdz=0 dvdx=0 fpeak=30 smooth=1 \
	ref="1:-1.,.1;7.,.5" \
	ref="1:-1.,.5;7.,.2" \
	ref="2:-1.,.5;7.,.9" |
sushw key=d2 a=.05 >susyn1.out
sufilter <susyn1.out >susyn1.flt

suaddnoise < susyn1.out  sn=8 f=4,8,100,125 amps=0,1,1,0 |
sufilter >susyn1.sn=4.flt

suxmovie <susyn1.flt \
	label1="Time [s]" label2="Trace #"  d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF1}+${HEIGHTOFF1} \
	title="Signal"  perc=99.5 &

suxmovie <susyn1.sn=4.flt \
	label1="Time [s]" label2="Trace #"  d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF1}+${HEIGHTOFF2} \
	title="Data"  perc=99.5 &

sufxdecon <susyn1.sn=4.flt >susyn1.sn=4.fx ntrw=100  
suxmovie <susyn1.sn=4.fx  \
        label1="Time [s]" label2="Trace #"  d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF2}+${HEIGHTOFF1} \
	title="Fxdcn over Data"  perc=99.5 &

sufxdecon <susyn1.flt >susyn1.flt.fx ntrw=100
suxmovie <susyn1.flt.fx  \
        label1="Time [s]" label2="Trace #"  d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF2}+${HEIGHTOFF2} \
	title="Fxdcn over Signal"  perc=99.5   &

suop2 susyn1.flt susyn1.flt.fx op=diff |
suxmovie \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
        label1="Time [s]" label2="Trace #"  d1num=.1 d2num=10 \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF3}+${HEIGHTOFF1} \
	title="Diff: signal - fx(signal)"  perc=99.5  &
suop2 susyn1.flt susyn1.sn=4.fx op=diff |
suxmovie \
        label1="Time [s]" label2="Trace #"  d1num=.1 d2num=10 \
	n1=201 n2=100 d1=.004 d2=1 f1=0 f2=1 clip=30. \
	-geometry ${WIDTH}x${HEIGHT}+${WIDTHOFF3}+${HEIGHTOFF2} \
	title="Diff: signal - fx(data)"  perc=99.5 &

exit 0

